package com.dzu.easy;

/**
 * @author ZhaoDong
 * @date 2022/12/5 9:30
 * @description 168. Excel表列名称
 */
public class Test168 {
    public static void main(String[] args) {
        System.out.println(convertToTitle(1));

    }

    public static String convertToTitle(int columnNumber) {
        StringBuffer sb = new StringBuffer();
        while (columnNumber > 0) {
            columnNumber--;
            sb.append((char) (columnNumber % 26 + 'A'));

            columnNumber /= 26;
        }

        return sb.reverse().toString();
    }
}
